Skip to main content

All Questions

Tagged with
3votes
2answers
381views

Retry read/write until all bytes are transferred or error occurs

Currently I have a wrapper function for the read/write system calls, the purpose of which is to eliminate partial transfer ...
user avatar
1vote
1answer
1kviews

Read and sort 100 numbers from a text file

The program itself reads 100 values from a text file named input.txt. Then sorts those values in ascending order and writes the values to a new file called ...
HunterShaw's user avatar
4votes
2answers
239views

Reader for graph-file with ugly return and questionable use of streams

I wrote a class that contains a static method that reads in files from NetworkRepository and converts them into a list of integer-arrays, each representing an edge. The file format from ...
Moritz Groß's user avatar
2votes
0answers
804views

Implementation of SCPI for control of test instruments

I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that ...
OsakaRhymes's user avatar
3votes
3answers
193views

Calculate total, minimum, maximum and mean from a set of distances

I have only begun to learn C++ and am reading through the book, "Programming Principles and Practices Using C++". This bit of code is my attempt to complete exercise 3 at the end of chapter 4. The ...
Butch Crockett's user avatar
4votes
1answer
2kviews

Error handling with C-string input using get() and getline()

I've just learned the basics of c-strings and how to read line oriented input. I noticed that fail bits are set for each function. However, not every problem sends a fail bit, so I thought this would ...
Anonymous3.1415's user avatar
3votes
2answers
843views

C gets_s() implementation

I'm in a class that is using C, and my instructor has unfortunately used gets() in sample code. As this is obviously a heinous oversight, likely to cause undefined ...
CAD97's user avatar
  • 1,944
0votes
3answers
93views

Processing an InputStream and writing to an OuputStream, and ensuring that both streams get closed

Is it a bad thing to do multiple file closings in single finally block? Relevant excerpt: ...
industryworker3595112's user avatar
5votes
1answer
273views

Transferring data from one file stream to another

I am currently reading Clean Code and for fun and profit, I intended to refactor some of the Java Tutorials and since I wanted to improve my Exception handling, the Byte Stream one with its lots of ...
AdHominem's user avatar
4votes
2answers
263views

Property file loader

I have the following code: ...
Eugene Ustimenko's user avatar
5votes
2answers
16kviews

IO and Scanner exception handling

I have created a sample file reading program as an exercise while learning how to implement good exception handling. I want to ask: is this a good approach or is there some other solution that I am ...
Deepak Singh's user avatar
6votes
5answers
9kviews

Java Stream Exception Handling

I find this piece of Java code really ugly and cumbersome. How can I refactor it to be more clean and easier to read? ...
KirdApe's user avatar
15votes
2answers
17kviews

Better option than "errno" for file IO error handling

I have the following method for opening a file: ...
glampert's user avatar
8votes
3answers
21kviews

Validation/error handling of user input values

This is a tiny learning program that lead to an interesting question: how can I best/most elegantly handle user entered numbers? This method works, fails cleanly, and reads well. It doesn't apply to ...
Derek's user avatar
5votes
1answer
437views

Reading the contents of an XPI file

I wrote this code to list contents of an XPI file and then read the contents in it. I was thinking of these areas of improvement: I put the zr.open in the ...
Noitidart's user avatar

153050per page
close